
package com.dps.omc.service.impl;
import com.dps.omc.model.AgentNode;
import com.dps.omc.model.Job;
import com.dps.omc.model.Task;
import com.dps.common.utils.IdGenerator;
import com.dps.omc.model.TaskNode;
import com.dps.omc.service.ITaskNodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dps.common.service.impl.AbstractPageService;
import com.dps.omc.dao.ITaskNodeDAO;

@SuppressWarnings("unchecked")
@Service("TaskNodeServiceImpl")

public class TaskNodeServiceImpl extends AbstractPageService<ITaskNodeDAO,TaskNode> implements ITaskNodeService {

	@Autowired
	private ITaskNodeDAO taskNodeDAO;
	@Override
	public boolean getEnableDataPerm() {
		// TODO Auto-generated method stub
		return false;
	}
	@Override
	public ITaskNodeDAO getDao() {
		return taskNodeDAO;
	}

	@Override
	public TaskNode create(Job job, Task task , AgentNode agentNode) {

		TaskNode taskNode = new TaskNode();
		taskNode.setId(IdGenerator.createNewId());
		taskNode.setJobId(job.getId());
		taskNode.setTaskId(task.getId());
		taskNode.setNodeId(agentNode.getNodeId());
		taskNode.setIp(agentNode.getIp());
		taskNode.setBizType(agentNode.getBizType());
		taskNode.setGroupType(agentNode.getGroupType());
		taskNode.setOpSystem(agentNode.getOpSystem());
		taskNode.setBizUnit(agentNode.getBizUnit());
		taskNode.setSysRank(agentNode.getSysRank());
		taskNode.setAlias(agentNode.getAlias());
		taskNode.setIsTimer(task.getIsTimer());
		taskNode.setPlanDate(agentNode.getPlanDate());
		taskNode.setTeam(agentNode.getTeam());
		this.insert(taskNode);
		return taskNode;
	}
}
